<section class="course-list-section {{config.background|default("")}}" id="course-list">
  {% import "TopxiaWebBundle::macro.html.twig" as web_macro %}

  {% set count = config.count|default(12) %}
  {% set categoryId = config.categoryId|default(0) %}
  {% set orderBy = config.orderBy|default('latest')%}
  {% if orderBy == 'latest'%}
    {% set courses = data('LatestCourses',{'count':count, 'categoryId':categoryId}) %}
  {% elseif orderBy == 'recommendedSeq'%}
    {% set courses = data('RecommendCourses',{'count':count, 'categoryId':categoryId}) %}
  {% elseif orderBy == 'studentNum'%}
    {% set courses = data('PopularCourses',{'count':count, 'categoryId':categoryId,'type':'studentNum'}) %}
  {% endif %}
  {% set categoriesFirst = data('Categories',{'group':'course'})%}

  <section class="course-section panel panel-default">
    <h2 class="h4 section-title primary-line">{{ config.title|default(config.defaultTitle) }}
      <a href="{{ path('course_explore') }}" title="查看更多网络课程" class="section-more pull-right">更多>></a>
    </h2>
    <div class="course-collection">
      {% for course in courses %}
        {% include 'TopxiaWebBundle:Course:Widget/course-grid-index.html.twig' %}
      {% endfor %}
    </div>

    <a class="btn btn-block btn-default btn-lg" href="{{ path('course_explore') }}" title="查看更多网络课程">查看更多...</a>
  </section>
</section>
